package com.ihr360.payroll.service.alps.profile;


import com.google.common.collect.ImmutableList;
import com.ihr360.alps.PropertyDescriptor;
import com.ihr360.alps.PropertyType;
import com.ihr360.alps.ServiceDescriptor;
import com.ihr360.alps.api.ServiceProvider;
import com.ihr360.payroll.service.alps.profile.provider.ProfileParamProvider;
import com.ihr360.payroll.service.alps.profile.provider.SickLeaveParamProvider;

import java.util.List;

/**
 * 病假扣款规则Alps定义
 */
public class SickLeaveServiceProfile  extends BaseServiceProfile {
    public static final class DEFAULT_VAL {
        public static final double NUMOP_RATIO = 30.00;
        public static final double FIXED_BASE = 0.00;
        public static final double BASE_RATIO = 100.00;
    }

    public static final SickLeaveServiceProfile numOpRatio = new SickLeaveServiceProfile(0, "扣款比例", "numOpRatio", DEFAULT_VAL.NUMOP_RATIO);
    public static final SickLeaveServiceProfile basementType = new SickLeaveServiceProfile(1, "基数类型", "basementType", 0);
    public static final SickLeaveServiceProfile baseRatio = new SickLeaveServiceProfile(2, "基数比例", "baseRatio", DEFAULT_VAL.BASE_RATIO);
    //public static final SickLeaveServiceProfile fixedBase = new SickLeaveServiceProfile(3, "病假扣款基数", "fixedBase",DEFAULT_VAL.FIXED_BASE);

    public static final SickLeaveServiceProfile calcBase = new SickLeaveServiceProfile(4, "病假扣款基数", "calcBase", DEFAULT_VAL.FIXED_BASE);


    SickLeaveServiceProfile(int index, String name, String code, double defaultValue) {
        super(index, name, code, defaultValue);
    }

    public static ProfileParamProvider profileParamProvider = new SickLeaveParamProvider();

    public static ServiceDescriptor serviceDescriptor() {
        List<PropertyDescriptor> propertyDescriptors = ImmutableList
                .of(
                        //标准工时
                        PropertyDescriptor.builder()
                                .id(numOpRatio.getCode())
                                .name(numOpRatio.getName())
                                .type(PropertyType.String)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(basementType.getCode())
                                .name(basementType.getName())
                                .type(PropertyType.String)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(baseRatio.getCode())
                                .name(baseRatio.getName())
                                .type(PropertyType.String)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(calcBase.getCode())
                                .name(calcBase.getName())
                                .type(PropertyType.String)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(monthWorkCount.getCode())
                                .name(monthWorkCount.getName())
                                .type(PropertyType.String)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(dayWorkCount.getCode())
                                .name(dayWorkCount.getName())
                                .type(PropertyType.String)
                                .build()
                );
        return ServiceDescriptor.builder()
                .serviceId(ServiceProvider.SERVICE_ID.SALARY_SL_RULE)
                .name("病假扣款规则")
                .path("/alps/" + ServiceProvider.SERVICE_ID.SALARY_SL_RULE)
                .descriptors(propertyDescriptors)
                .build();
    }


}